package com.zhongwang.business.module.fileManage.controller;

import com.zhongwang.business.base.BaseController;
import com.zhongwang.business.common.JsonResult;
import com.zhongwang.business.module.fileManage.model.FileModel;
import com.zhongwang.business.module.fileManage.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.File;

@Controller
public class FileController extends BaseController {
    @Autowired
    private FileService fileService;

    /**
     * 查询附件信息：
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("/file/selFileInfoByCondition")
    public JsonResult selFileInfoByCondition(FileModel model){
//        startPage();
        return jsonResult(fileService.selFileInfo(model));
    }
    /**
     * 查询附件信息：
     * @param model
     * @return
     */
    @ResponseBody
    @PostMapping("/file/selFileInfoByConId")
    public JsonResult selFileInfoByConId(FileModel model){

        return jsonResult(fileService.selFileInfoByConId(model.getMainId()));
    }


    /**
     * 查询附件信息：注意合同的话，类型是3；
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/file/delFileInfo")
    public JsonResult delFileInfo(Integer id){
        return jsonResult(fileService.delFileInfo(id));
    }

    /**
     * 查询附件信息
     * @param id
     * @return
     */

    /**
     * 查询附件信息：
     * @param id
     * @return
     */
    @ResponseBody
    @PostMapping("/file/selFileInfoById")
    public FileModel selFileInfoById(Integer id){
        return fileService.selFileInfoById(id);
    }


}
